package gisutil
{
	import com.esri.ags.geometry.Extent;
	import com.esri.ags.geometry.Geometry;
	import com.esri.ags.geometry.MapPoint;
	import com.esri.ags.geometry.Polygon;
	import com.esri.ags.geometry.Polyline;
	
	import mx.collections.ArrayCollection;
	import mx.collections.ArrayList;
	
	
	public class SelectRegionOnly
	{
		// 类型: extent or polygon
		public var regionType:String;
		
		// 区域边界		
		public var bound: RegionBound;
		
		// 多边形点[目前只是选取第一个rings]
		public var map_points:ArrayList;		
		
		public function SelectRegionOnly()
		{
		}
		
		public function Build( grh:Geometry ):void
		{
			bound = new RegionBound();
			bound.Bulid( grh.extent );			
			
			if( grh is Polygon )
			{
				regionType = "polygon";
				
				var po:Polygon = grh as Polygon;
				map_points = new ArrayList();
				
				for each (var p:MapPoint in po.rings[0])
				{
					var tmp:MapPoint = new MapPoint();
					tmp.x = p.x;
					tmp.y = p.y;
					map_points.addItem( tmp );	
				}				
			}
			else if( grh is Extent )
			{
				regionType = "extent";
			}
		}
	}
}